package View;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextField;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;

import Controller.Sistema;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class AltaPaquete extends javax.swing.JFrame {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JLabel lblDescripcion;
	private JTextField txtDescripcionPaquete;
	private JTextField txtDescuentoPaquete;
	private JButton btnCrearPaquete;
	private JLabel lblDescuentoPaquete;

	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				AltaPaquete inst = new AltaPaquete();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public AltaPaquete() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);
			{
				lblDescripcion = new JLabel();
				getContentPane().add(lblDescripcion);
				lblDescripcion.setText("Descripcion");
				lblDescripcion.setBounds(30, 12, 62, 16);
			}
			{
				txtDescripcionPaquete = new JTextField();
				getContentPane().add(txtDescripcionPaquete);
				txtDescripcionPaquete.setBounds(104, 9, 240, 23);
			}
			{
				lblDescuentoPaquete = new JLabel();
				getContentPane().add(lblDescuentoPaquete);
				lblDescuentoPaquete.setText("Descuento:");
				lblDescuentoPaquete.setBounds(30, 45, 61, 16);
			}
			{
				txtDescuentoPaquete = new JTextField();
				getContentPane().add(txtDescuentoPaquete);
				txtDescuentoPaquete.setBounds(103, 42, 241, 23);
			}
			{
				btnCrearPaquete = new JButton();
				getContentPane().add(btnCrearPaquete);
				btnCrearPaquete.setText("Crear Paquete");
				btnCrearPaquete.setBounds(132, 98, 88, 23);
				btnCrearPaquete.addActionListener(new ActionListener(){
					public void actionPerformed(ActionEvent arg0) {
						Sistema.getInstancia().altaPaquete(txtDescripcionPaquete.getText(), Float.valueOf(txtDescuentoPaquete.getText()));
					}
					
				});
			}
			pack();
			this.setSize(382, 171);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
